from __future__ import unicode_literals
from django.db import models
from django.utils.timezone import now

# Create your models here.


class OptimizeDetailList(models.Model):
    CIRCLE_CHOICES = (
        ('0', '未闭环'),
        ('1', '闭环'),
    )
    local_id = models.IntegerField(verbose_name='本地工单编号')
    care_id = models.IntegerField(verbose_name='服保工单编号')
    start_date = models.DateTimeField(verbose_name='开始日期', blank=True, null=True)
    end_date = models.DateTimeField(verbose_name='结束日期', blank=True, null=True)
    upload_date = models.DateTimeField(verbose_name='上传服保时间', blank=True, null=True)
    admin_reply_date = models.DateTimeField(verbose_name='管理员批复时间', blank=True, null=True)
    finish_date = models.DateTimeField(verbose_name='脚本完成时间', blank=True, null=True)
    order_res_date = models.DateTimeField(verbose_name='工单回复时间', blank=True, null=True)
    content = models.CharField(verbose_name='工单内容', blank=True, null=True, max_length=100)
    circle_flag = models.CharField(max_length=8, choices=CIRCLE_CHOICES, blank=True, null=True)

    # 使对象在后台显示更友好
    def __str__(self):  # 必须返回string
        return '{}'.format(self.local_id)

    class Meta:
        ordering = ['local_id']
        verbose_name = '邻区自动优化工单详情'  # 指定后台显示模型名称
        verbose_name_plural = '邻区自动优化工单详情列表'  # 指定后台显示模型复数名称
        db_table = 'adj_optimize_detail_list'  # 数据库表名


class OptimizePlanRedList(models.Model):
    network_type = models.CharField(verbose_name='网络制式', blank=True, null=True, max_length=30)
    date = models.DateField(verbose_name='时间', blank=True, null=True)
    scell_name = models.CharField(verbose_name='主小区名', blank=True, null=True, max_length=100)
    scell_enodeB_id = models.IntegerField(verbose_name='主小区eNodeB ID', blank=True, null=True)
    scell_ci = models.IntegerField(verbose_name='主小区CI', blank=True, null=True)
    scell_sitetype = models.CharField(verbose_name='主小区站型', blank=True, null=True, max_length=50)
    ncell_name = models.CharField(verbose_name='邻小区名', blank=True, null=True, max_length=100)
    ncell_enodeB_id = models.IntegerField(verbose_name='邻小区eNodeB ID', blank=True, null=True)
    ncell_ci = models.IntegerField(verbose_name='邻小区CI', blank=True, null=True)
    ncell_sitetype = models.CharField(verbose_name='邻小区站型', blank=True, null=True, max_length=50)
    area = models.CharField(verbose_name='分区', blank=True, null=True, max_length=50)
    vendor = models.CharField(verbose_name='厂家', blank=True, null=True, max_length=50)

    def __str__(self):  # 必须返回string
        return '{}'.format(self.scell_name)

    class Meta:
        ordering = ['scell_enodeB_id']
        verbose_name = '邻区自动优化冗余小区详情'
        verbose_name_plural = '邻区自动优化冗余小区详情列表'
        db_table = 'adj_optimize_redundant_list'


